<%@ page language="java" import="java.util.*,com.ovt.entity.Page,com.ovt.entity.*,com.ovt.biz.*,com.ovt.biz.impl.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body>
  
     <%
     int pageIndex = 1;//获得当前页数
     //网址
     if(request.getParameter("pageIndex") != null){
         pageIndex = Integer.parseInt(request.getParameter("pageIndex").toString());
     }
     Page pages=new Page();
     pages.setCurrPageNo(pageIndex);    //设置当前页面
     pages.setPageSize(2);    //设置每页条数
     UserBiz userBiz=new UserBizImpl();
     int totalCount = userBiz.getUserListCount();
     pages.setTotalCount(totalCount);
     List<User> list = userBiz.getUserList(pages);
      %>
         <table border="1" cellpadding="0" cellspacing="0">
        <tr>
        	<td>用户id</td>
        	<td>用户名</td>
        	<td>用户密码</td>
        </tr>
       <%
    		int totalpages=pages.getTotalPageCount();  //总页数
    		for(User user:list){
       %>
    	   <tr>
    	       <td><%=user.getUid()%></td>
    	       <td><%=user.getUname() %></td>
    	       <td><%=user.getUpwd()%></td>
    	   </tr>	
    	<%
    	     }
    	 %>
    	  </table> 
    	 当前页数：[<%=pageIndex%>/<%=totalpages%>]
    	 <%
   			 if(pageIndex > 1){		//控制页面显示风格
		 %>   
   			 <a href="index.jsp?pageIndex=1">首页</a>&nbsp;
    		 <a href="index.jsp?pageIndex=<%= pageIndex -1%>">上一页</a>
		<% }
    	   if(pageIndex < totalpages){	//控制页面显示风格
		%>
    		<a href="index.jsp?pageIndex=<%= pageIndex +1%>">下一页</a>
    		<a href="index.jsp?pageIndex=<%=totalpages%>">末页</a> 
		<%}
     %>   
  </body>
</html>
